home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Freeware / Griffith 0.9.8 / griffith-0.9.8-win32.exe / {app} / lib / about.py next >
Text File  |  2008-11-17  |  3KB  |  89 lines

  1. # -*- coding: UTF-8 -*-
  2.  
  3. __revision__ = '$Id: about.py 1040 2008-11-15 21:13:49Z mikej06 $'
  4.  
  5. # Copyright (c) 2005-2008 Vasco Nunes, Piotr O┼╝arowski
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. # GNU Library General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
  20.  
  21. # You may use and distribute this software under the terms of the
  22. # GNU General Public License, version 2 or later
  23.  
  24. import gtk
  25. import version
  26. import os
  27. import sys
  28.  
  29. class AboutDialog:
  30.     """Shows a gtk about dialog"""
  31.     def __init__(self, locations):
  32.         TRANSLATORS_FILE = os.path.join(locations['share'], 'TRANSLATORS') # remember to encode this file in UTF-8
  33.         IMAGES_DIR = locations['images']
  34.         dialog = gtk.AboutDialog()
  35.         dialog.set_name(version.pname)
  36.         dialog.set_version(version.pversion)
  37.         dialog.set_copyright("Copyright ┬⌐ 2005-2008 Vasco Nunes. Piotr O┼╝arowski")
  38.         dialog.set_website(version.pwebsite)
  39.         dialog.set_authors([
  40.             _("Main Authors") + ':',
  41.             version.pauthor.replace(', ', '\n') + "\n",
  42.             _("Programmers") + ':',
  43.             'Jessica Katharina Parth <Jessica.K.P@women-at-work.org>',
  44.             'Michael Jahn <mikej06@hotmail.com>\n',
  45.             _('Contributors:'), # FIXME: remove ":"
  46.             'Christian Sagmueller <christian@sagmueller.net>\n' \
  47.             'Arjen Schwarz <arjen.schwarz@gmail.com>'
  48.         ])
  49.         dialog.set_artists([_("Logo, icon and general artwork " + \
  50.             "by Peek <peekpt@gmail.com>." + \
  51.             "\nPlease visit http://www.peekmambo.com/\n"),
  52.             'seen / unseen icons by dragonskulle <dragonskulle@gmail.com>'
  53.         ])
  54.         data = None
  55.         if os.path.isfile(TRANSLATORS_FILE):
  56.             data = open(TRANSLATORS_FILE).read()
  57.         elif os.path.isfile(TRANSLATORS_FILE+'.gz'):
  58.             from gutils import decompress
  59.             data = decompress(open(TRANSLATORS_FILE + '.gz').read())
  60.         elif os.name == 'posix':
  61.             if os.path.isfile('/usr/share/doc/griffith/TRANSLATORS'):
  62.                 data = open('/usr/share/doc/griffith/TRANSLATORS').read()
  63.             elif os.path.isfile('/usr/share/doc/griffith/TRANSLATORS.gz'):
  64.                 from gutils import decompress
  65.                 data = decompress(open('/usr/share/doc/griffith/TRANSLATORS.gz').read())
  66.         translator_credits = ''
  67.         if data:
  68.             for line in data.split('\n'):
  69.                 if line.startswith('* '):
  70.                     lang = line[2:]
  71.                     if _(lang) != lang:
  72.                         line = "* %s:" % _(lang)
  73.                 translator_credits += "%s\n" % line
  74.         else:
  75.             translator_credits = _("See TRANSLATORS file")
  76.         dialog.set_translator_credits(translator_credits)
  77.         logo_file = os.path.abspath(os.path.join(IMAGES_DIR, 'griffith.png'))
  78.         logo = gtk.gdk.pixbuf_new_from_file(logo_file)
  79.         dialog.set_logo(logo)
  80.         if os.path.isfile('/usr/share/common-licenses/GPL-2'):
  81.             dialog.set_license(open('/usr/share/common-licenses/GPL-2').read())
  82.         else:
  83.             dialog.set_license(_("This program is released under the GNU" + \
  84.                 "General Public License.\n" + \
  85.                 "Please visit http://www.gnu.org/copyleft/gpl.html for details."))
  86.         dialog.set_comments(version.pdescription)
  87.         dialog.run()
  88.         dialog.destroy()
  89.